package com.mocne.xTestDemo;

import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.HashMap;
import java.util.Map;

import org.openqa.selenium.WebDriver;

public class test {

    public static void main(String[] argc) throws InterruptedException {

        WebDriver webDriver;

        System.out.println("beforeClass");
        System.setProperty("webdriver.chrome.driver", "/Users/pengkaifeng/BrowserDrivers/chromedriver");// chromedriver服务地址
        ChromeOptions options = new ChromeOptions();
        Map<String, Object> prefs = new HashMap<>();
        prefs.put("disable-infobars", 2);

        //关闭使用ChromeDriver打开浏览器时上部提示语"Chrome正在受到自动软件的控制"
        options.addArguments("disable-infobars");

        //加载浏览器的静默模式，使浏览器在后台运行
//        options.addArguments("headless");

        options.setExperimentalOption("prefs", prefs);


        webDriver = new ChromeDriver(options);

        webDriver.get("http://erp.test.jimuitech.com/#/login");
        Thread.sleep(2000);
        webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[2]/form/div[1]/div/div[1]/input")).sendKeys("kap1chn");
        webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[2]/form/div[2]/div/div/input")).sendKeys("1234qwer");
        webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[2]/form/div[3]/div/button")).click();
        Thread.sleep(2000);
        webDriver.findElements(By.className("country-item")).get(0).click();
        Thread.sleep(10000);
        Thread.sleep(9999999);
    }
}
